
package com.hlkj.pay.app.merchant.ext.impl.helipay;
/*
 * Hlpay-Plus aggregate payment system.
 * Copyright (c) 2024-2025 Hlpay Team Copyright has the right of final interpretation.
 */

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Repository;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;

import com.hlkj.framework.common.pojo.CommonResult;
import com.hlkj.framework.common.util.json.JsonUtils;
import com.hlkj.framework.extension.annotation.Extension;
import com.hlkj.pay.app.merchant.ext.ChannelMerchantReportExtPt;
import com.hlkj.pay.app.merchant.ext.MerchantExtConstant;
import com.hlkj.pay.app.merchant.ext.dto.payment.ChannelVirtualAccountContext;
import com.hlkj.pay.app.merchant.ext.dto.report.*;
import com.hlkj.pay.app.merchant.ext.impl.baofu.dto.BoaFuAppChannelParams;
import com.hlkj.pay.app.merchant.ext.impl.helipay.dto.HeliPayEatrxConfig;
import com.hlkj.pay.app.merchant.ext.impl.helipay.dto.eatrx.*;
import com.hlkj.pay.app.merchant.ext.impl.helipay.handler.HeliPayMerchantEatrxCommonParamsHandle;
import com.hlkj.pay.app.merchant.ext.impl.helipay.handler.HeliPayMerchantEatrxParamsHandle;
import com.hlkj.pay.app.merchant.ext.impl.helipay.util.Des3;
import com.hlkj.pay.dto.merchant.ReportChannelParamsDto;
import com.hlkj.pay.dto.merchant.VirtualBalanceDto;
import com.hlkj.pay.dto.merchant.report.MerchantReportDto;
import com.hlkj.pay.enums.MerchantEnum;
import com.hlkj.pay.infrastructure.model.merchant.MerchantAppChannelDO;
import com.hlkj.pay.infrastructure.model.merchant.MerchantReportAmountDO;
import com.hlkj.pay.infrastructure.model.merchant.MerchantReportInfoDO;
import com.hlkj.pay.infrastructure.model.pay.PayChannelRequestDO;
import com.hlkj.pay.infrastructure.model.pay.ProviderChannelConfigDO;
import com.hlkj.pay.service.pay.IPayChannelDictService;
import com.hlkj.pay.util.DateUtils;
import com.hlkj.pay.util.HttpRequestUtil;
import com.hlkj.pay.util.MerchantUtils;

import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
 * heepay报备操作
 * 
 * @author HlpayTeam
 * @date 2024/09/26 10:25
 */
@Slf4j
@Repository
@RequiredArgsConstructor
@Extension(bizId = MerchantExtConstant.CHANNEL_HELIPAY_VIR)
public class HeliPayMerchantReportExtPt extends HeliPayMerchantEatrxCommonParamsHandle implements ChannelMerchantReportExtPt {

    private final HeliPayMerchantEatrxParamsHandle heliPayMerchantEatrxParamsHandle;

    private final IPayChannelDictService payChannelDictService;

    @Override
    public String requestUrl(MerchantReportDto merchantReportDto) {
        return "";
    }

    @Override
    public void merchantReport(ChannelMerchantReportContext channelMerchantReportContext) {
        CommonResult<HeliPayEatrxConfig> configCommonResult = heliPayMerchantEatrxParamsHandle.heliPayEatrxConfig(channelMerchantReportContext.getProviderChannelConfig(),
                channelMerchantReportContext.isTest());
        if (!configCommonResult.isSuccess()) {
            channelMerchantReportContext.setRemark(configCommonResult.getMsg());
            channelMerchantReportContext.setProcessStatus(false);
            return;
        }
        // 参数校验
        CommonResult<Void> checkResult = heliPayMerchantEatrxParamsHandle.merchantReportParamsCheck(channelMerchantReportContext);
        if (!checkResult.isSuccess()) {
            channelMerchantReportContext.setRemark(checkResult.getMsg());
            channelMerchantReportContext.setProcessStatus(false);
            return;
        }
        HeliPayEatrxConfig heliPayEatrxConfig = configCommonResult.getData();
        // 先上传文件
        heliPayMerchantEatrxParamsHandle.addProcessFileId(channelMerchantReportContext, heliPayEatrxConfig);
        if (!channelMerchantReportContext.isProcessStatus()) {
            return;
        }
        Map<String, Object> params;
        MerchantReportInfoDO merchantReportInfo = channelMerchantReportContext.getMerchantReportDto().getMerchantReportInfo();
        String url = url(channelMerchantReportContext.isTest());
        switch (MerchantEnum.MERCHANT_TYPE.from(merchantReportInfo.getType())) {
            case PERSONAL:
                params = heliPayMerchantEatrxParamsHandle.merchantReportPersonalAddParams(channelMerchantReportContext);
                url = url + "/ea/pCustomerReg.action";
                break;
            default:
                params = heliPayMerchantEatrxParamsHandle.merchantReportAddParams(channelMerchantReportContext);
                url = url + "/ea/eCustomerReg.action";
        }
        PayChannelRequestDO payChannelRequestDO = new PayChannelRequestDO();
        payChannelRequestDO.setRequestUrl(url);
        payChannelRequestDO.setRequestParams(JsonUtils.toJsonString(params));

        // 再提交数据
        CommonResult<HeePayEatrxReportRes> commonResult = productRequest(params, url, HeePayEatrxReportRes.class, heliPayEatrxConfig);
        payChannelRequestDO.setResponse(JsonUtils.toJsonString(commonResult));
        channelMerchantReportContext.setPayChannelRequestDO(payChannelRequestDO);
        if (!commonResult.isSuccess()) {
            channelMerchantReportContext.setRemark(commonResult.getMsg());
            channelMerchantReportContext.setProcessStatus(false);
            return;
        }

        HeePayEatrxReportRes commonResultData = commonResult.getData();
        if (!StringUtils.hasText(merchantReportInfo.getSubMchId())) {
            if (!commonResultData.success()) {
                channelMerchantReportContext.setRemark(commonResultData.getRetMsg());
                channelMerchantReportContext.setProcessStatus(false);
                return;
            }
            merchantReportInfo.setSubMchId(commonResultData.getSysUserId());
        }
        channelMerchantReportContext.setReportStatus(MerchantEnum.REPORT_STATUS.CHANNEL_APPROVE);
    }

    @Override
    public String channelParams(ReportChannelParamsDto accessChannelParamsDto) {
        HeliPayEatrxAppChannelParams heliPayEatrxAppChannelParams = new HeliPayEatrxAppChannelParams();
        heliPayEatrxAppChannelParams.setUserId(accessChannelParamsDto.getUserId());
        heliPayEatrxAppChannelParams.setVirtualAccountNo(accessChannelParamsDto.getVirtualAccountNo());
        heliPayEatrxAppChannelParams.setBankCardId(accessChannelParamsDto.getBankCardId());
        return JsonUtils.toJsonString(heliPayEatrxAppChannelParams);
    }

    @Override
    public void merchantReportQuery(ChannelMerchantReportQueryContext channelMerchantReportQueryContext) {
        CommonResult<HeliPayEatrxConfig> configCommonResult = heliPayMerchantEatrxParamsHandle.heliPayEatrxConfig(channelMerchantReportQueryContext.getProviderChannelConfig(),
                channelMerchantReportQueryContext.isTest());
        if (!configCommonResult.isSuccess()) {
            channelMerchantReportQueryContext.setRemark(configCommonResult.getMsg());
            channelMerchantReportQueryContext.setProcessStatus(false);
            return;
        }
        HeliPayEatrxConfig heliPayEatrxConfig = configCommonResult.getData();
        Map<String, Object> params = new HashMap<>();
        MerchantReportInfoDO merchantReportInfo = channelMerchantReportQueryContext.getMerchantReportInfo();
        params.put("userId", merchantReportInfo.getUserId());
        String url = url(channelMerchantReportQueryContext.isTest()) + "/ea/merchantUserQuery.action";
        // 再提交数据
        CommonResult<HeePayEatrxReportQueryRes> commonResult = productRequest(params, url, HeePayEatrxReportQueryRes.class, heliPayEatrxConfig);
        log.info("merchantReportQuery 返回参数:{}", JSONUtil.toJsonStr(commonResult));
        if (!commonResult.isSuccess()) {
            channelMerchantReportQueryContext.setRemark(commonResult.getMsg());
            channelMerchantReportQueryContext.setProcessStatus(false);
            return;
        }
        HeePayEatrxReportQueryRes eatrxReportQueryRes = commonResult.getData();
        if (!eatrxReportQueryRes.success()) {
            // 查询太快，请联系商务 不判断
            if("0005".equals(eatrxReportQueryRes.getRetCode()) && StrUtil.isNotEmpty(eatrxReportQueryRes.getRetMsg()) && StrUtil.containsIgnoreCase(eatrxReportQueryRes.getRetMsg(),"请联系商务")){
                log.info("merchantReportQuery 报备查询太快，请联系商务 不判断 返回参数:{}", JSONUtil.toJsonStr(eatrxReportQueryRes));
                return;
            }
            channelMerchantReportQueryContext.setRemark(eatrxReportQueryRes.getRetMsg());
            channelMerchantReportQueryContext.setProcessStatus(false);
            return;
        }
        HeePayEatrxReportQueryRes.MerchantUserQueryDTO bean = eatrxReportQueryRes.getBean();
        String merchantChannelStatus = bean.getMerchantChannelStatus();
        MerchantEnum.REPORT_BANK_STATUS reportBankStatus = null;
        MerchantEnum.REPORT_STATUS reportStatus = null;
        switch (bean.getStatus()) {
            case "AUDIT_FAIL":
                channelMerchantReportQueryContext.setRemark(merchantChannelStatus);
                channelMerchantReportQueryContext.setProcessStatus(false);
                break;
            case "ACTIVE":
                HeliPayReportExtentDto heliPayReportExtentDto = new HeliPayReportExtentDto();
                heliPayReportExtentDto.setVirtualAccountNo(bean.getVirtualAccountNo());
                heliPayReportExtentDto.setOnlineMerchantNo(bean.getOnlineMerchantNo());
                merchantReportInfo.setVirtualAccountNo(bean.getVirtualAccountNo());
                // INIT:初始化,
                // DOING:处理中
                // FAIL:失败
                // SUCCESS:报备成功
                reportStatus = MerchantEnum.REPORT_STATUS.CHANNEL_APPROVE;
                if (StringUtils.hasText(merchantReportInfo.getSignLink())) {
                    reportStatus = MerchantEnum.REPORT_STATUS.WAIT_SIGNING;
                }
                switch (merchantChannelStatus) {
                    case "INIT":
                        reportBankStatus = MerchantEnum.REPORT_BANK_STATUS.INIT;
                        break;
                    case "DOING":
                        reportBankStatus = MerchantEnum.REPORT_BANK_STATUS.DOING;
                        break;
                    case "FAIL":
                        // reportBankStatus = MerchantEnum.REPORT_BANK_STATUS.FAIL;
                        // reportStatus = MerchantEnum.REPORT_STATUS.APPROVE_REFUSE;
                        channelMerchantReportQueryContext.setRemark(bean.getChannelRegisterMsg());
                        channelMerchantReportQueryContext.setProcessStatus(false);
                        return;
                    case "SUCCESS":
                        reportBankStatus = MerchantEnum.REPORT_BANK_STATUS.SUCCESS;
                        reportStatus = MerchantEnum.REPORT_STATUS.APPROVE_SUCCESS;
                        break;
                    default:
                }
                String bankCardId = "";
                if (!CollectionUtils.isEmpty(bean.getReports())) {
                    HeePayEatrxReportQueryRes.ReportDTO reportDTO = bean.getReports().get(0);
                    channelMerchantReportQueryContext.setRemark(reportDTO.getDescription());
                    List<HeePayEatrxReportQueryRes.BindCardDTO> cards = reportDTO.getCards();
                    if (!CollectionUtils.isEmpty(cards)) {
                        HeePayEatrxReportQueryRes.BindCardDTO bindCardDTO = cards.get(0);
                        heliPayReportExtentDto.setBankCardId(bindCardDTO.getBankCardId());
                        bankCardId = bindCardDTO.getBankCardId();
                        if (StringUtils.hasText(bindCardDTO.getDescription())) {
                            channelMerchantReportQueryContext.setRemark(bindCardDTO.getDescription());
                        }
                        switch (bindCardDTO.getBindStatus()) {
                            case "VERIFY_INIT":
                            case "VERIFY_DOING":
                                reportStatus = MerchantEnum.REPORT_STATUS.WAIT_SIGN;
                                break;
                        }
                    }
                }
                merchantReportInfo.setBankCardId(bankCardId);
                merchantReportInfo.setExtendA(JsonUtils.toJsonString(heliPayReportExtentDto));
                channelMerchantReportQueryContext.setReportStatus(reportStatus);
                channelMerchantReportQueryContext.setReportBankStatus(reportBankStatus);
                // channelMerchantReportQueryContext.setAuditStatus(MerchantEnum.REPORT_CHANNEL_CONFIG_STATUS.SMS_SEND);
                break;
            case "SIGNING":
                params = new HashMap<>();
                params.put("userId", merchantReportInfo.getUserId());
                bankCardId = "";
                if (CollectionUtils.isEmpty(bean.getReports())) {
                    HeePayEatrxReportQueryRes.ReportDTO reportDTO = bean.getReports().get(0);
                    List<HeePayEatrxReportQueryRes.BindCardDTO> cards = reportDTO.getCards();
                    if (CollectionUtils.isEmpty(cards)) {
                        bankCardId = cards.get(0).getBankCardId();
                    }
                }

                params.put("bankCardId", bankCardId);
                url = url(channelMerchantReportQueryContext.isTest()) + "/ea/accountBindVerifyUrlQuery";
                // 再提交数据
                CommonResult<HeePayEatrxReportSignRes> signResult = productRequest(params, url, HeePayEatrxReportSignRes.class, heliPayEatrxConfig);
                HeePayEatrxReportSignRes eatrxReportSignRes = signResult.getData();
                merchantReportInfo.setSignLink(eatrxReportSignRes.getVerifyUrl());
                channelMerchantReportQueryContext.setReportStatus(MerchantEnum.REPORT_STATUS.WAIT_SIGNING);
                // channelMerchantReportQueryContext.setAuditStatus(MerchantEnum.REPORT_CHANNEL_CONFIG_STATUS.SMS_SEND);
                break;
            default:
                channelMerchantReportQueryContext.setReportStatus(MerchantEnum.REPORT_STATUS.CHANNEL_APPROVE);
        }
    }

    @Override
    public void merchantReportSign(ChannelMerchantReportSignContext channelMerchantReportSignContext) {
        CommonResult<HeliPayEatrxConfig> configCommonResult = heliPayMerchantEatrxParamsHandle.heliPayEatrxConfig(channelMerchantReportSignContext.getProviderChannelConfig(),
                channelMerchantReportSignContext.isTest());
        if (!configCommonResult.isSuccess()) {
            channelMerchantReportSignContext.setRemark(configCommonResult.getMsg());
            channelMerchantReportSignContext.setProcessStatus(false);
            return;
        }
        HeliPayEatrxConfig heliPayEatrxConfig = configCommonResult.getData();
        Map<String, Object> params = new HashMap<>();
        MerchantReportInfoDO merchantReportInfo = channelMerchantReportSignContext.getMerchantReportInfo();
        params.put("userId", merchantReportInfo.getUserId());
        params.put("bankCardId", merchantReportInfo.getBankCardId());
        String url = url(channelMerchantReportSignContext.isTest()) + "/ea/accountBindVerifyUrlQuery";
        // 再提交数据
        CommonResult<HeePayEatrxReportSignRes> commonResult = productRequest(params, url, HeePayEatrxReportSignRes.class, heliPayEatrxConfig);
        if (!commonResult.isSuccess()) {
            channelMerchantReportSignContext.setRemark(commonResult.getMsg());
            channelMerchantReportSignContext.setProcessStatus(false);
            return;
        }
        HeePayEatrxReportSignRes eatrxReportSignRes = commonResult.getData();
        if (!eatrxReportSignRes.success()) {
            channelMerchantReportSignContext.setRemark(eatrxReportSignRes.getRetMsg());
            channelMerchantReportSignContext.setProcessStatus(false);
            return;
        }
        merchantReportInfo.setSignLink(eatrxReportSignRes.getVerifyUrl());
        channelMerchantReportSignContext.setReportStatus(MerchantEnum.REPORT_STATUS.WAIT_SIGNING);
        channelMerchantReportSignContext.setReportBankStatus(MerchantEnum.REPORT_BANK_STATUS.VERIFY);
    }

    @Override
    public MerchantReportCallBackDto submitReportCallBackParamsParse(HttpServletRequest request, ProviderChannelConfigDO providerChannelConfigDO) {
        return null;
    }

    @Override
    public MerchantReportAmountCallBackDto reportAmountCallBackParamsParse(HttpServletRequest request) {
        return null;
    }

    @Override
    public CommonResult<MerchantReportAmountCallBackDto> reportAmountCallBackParamsParse(HttpServletRequest request, ProviderChannelConfigDO providerChannelConfigDO) {
        MerchantReportAmountCallBackDto merchantReportAllotCallBackDto = new MerchantReportAmountCallBackDto();
        String response = HttpRequestUtil.requestBodyParams(request);
        CommonResult<HeliPayEatrxConfig> commonResult = heliPayEatrxConfig(providerChannelConfigDO, false);
        Map<String, String> params = JsonUtils.parseObject(response, Map.class);
        String merchantNo = params.get("merchantNo");
        String data = params.get("data");
        String sign = params.get("sign");
        String source = merchantNo + "&" + data;
        HeliPayEatrxConfig heliPayConfig = commonResult.getData();
        try {
            String responseData = Des3.decode(heliPayConfig.getProductDes3Key(), data);
            HeliReportAmountNotifyRes heliReportAmountNotifyRes = JsonUtils.parseObject(responseData, HeliReportAmountNotifyRes.class);
            log.info("合利宝电子户入金通知 响应结果 results:{}", responseData);
            merchantReportAllotCallBackDto.setCallBackBody(responseData);
            MerchantReportAmountDO merchantReportAmountDO = new MerchantReportAmountDO();
            merchantReportAmountDO.setAmount(MerchantUtils.fenToYuan(heliReportAmountNotifyRes.getAmount()));
            if (StringUtils.hasText(heliReportAmountNotifyRes.getCompleteDate())) {
                try {
                    merchantReportAmountDO.setRecordTime(DateUtils.shanghaiDate(heliReportAmountNotifyRes.getCompleteDate(), "yyyy-MM-dd HH:mm:ss"));
                }
                catch (Exception e) {

                }
            }
            merchantReportAmountDO.setRemark(heliReportAmountNotifyRes.getDescription());
            merchantReportAmountDO.setPeerAccNo(heliReportAmountNotifyRes.getAccountNo());
            merchantReportAmountDO.setPeerAccName(heliReportAmountNotifyRes.getAccountName());
            merchantReportAmountDO.setAcctId(heliReportAmountNotifyRes.getVirtualAccountNo());
            merchantReportAmountDO.setSubMchId(heliReportAmountNotifyRes.getSysUserId());
            merchantReportAmountDO.setProcessStatus(MerchantEnum.REPORT_AMOUNT_STATUS.SUCCESS.getCode());
            merchantReportAllotCallBackDto.setMerchantReportAmount(merchantReportAmountDO);
            return CommonResult.success(merchantReportAllotCallBackDto);
        }
        catch (Exception e) {
            return CommonResult.error(1, e.getMessage());
        }
    }

    @Override
    public Boolean verifyCallBackParamsParse(String callBackBody, ProviderChannelConfigDO providerChannelConfigDO) {
        return true;
    }

    @Override
    public MerchantReportAllotCallBackDto reportAllotCallBackParamsParse(HttpServletRequest request, ProviderChannelConfigDO providerChannelConfigDO) {
        return null;
    }

    @Override
    public void merchantReportAllot(ChannelMerchantReportBusContext channelMerchantReportBusContext) {

    }

    @Override
    public void merchantReportAllotQuery(ChannelMerchantReportBusContext channelMerchantReportQueryContext) {
    }

    @Override
    public void merchantReportAllotProof(ChannelMerchantReportBusContext channelMerchantReportQueryContext) {

    }

    @Override
    public void merchantReportSignQuery(ChannelMerchantReportQueryContext channelMerchantReportQueryContext) {
        merchantReportQuery(channelMerchantReportQueryContext);
    }

    @Override
    public void queryChannelAccount(ChannelVirtualAccountContext channelVirtualAccountContext) {
        log.info("合利宝提交余额查询 mchChannelCode:{}", channelVirtualAccountContext.getMerchantAppChannelDO().getCode());
        CommonResult<HeliPayEatrxConfig> configCommonResult = heliPayEatrxConfig(channelVirtualAccountContext.getProviderChannelConfig(), channelVirtualAccountContext.isTest());
        if (!configCommonResult.isSuccess()) {
            channelVirtualAccountContext.setRemark(configCommonResult.getMsg());
            channelVirtualAccountContext.setProcessStatus(false);
            return;
        }
        HeliPayEatrxConfig heliPayEatrxConfig = configCommonResult.getData();
        HeliPayEatrxAppChannelParams heliPayEatrxAppChannelParams = heePayAppChannelParams(channelVirtualAccountContext.getMerchantAppChannelDO());
        Map<String, Object> params = new HashMap<>();
        params.put("userId", heliPayEatrxAppChannelParams.getUserId());
        params.put("virtualAccountNo", heliPayEatrxAppChannelParams.getVirtualAccountNo());
        String url = url(channelVirtualAccountContext.isTest()) + "/ea/userBalanceQuery";
        try {
            CommonResult<HeePayEatrxBalanceQueryRes> commonResult = productRequest(params, url, HeePayEatrxBalanceQueryRes.class, heliPayEatrxConfig);
            if (!commonResult.isSuccess()) {
                channelVirtualAccountContext.setProcessStatus(false);
                channelVirtualAccountContext.setRemark(commonResult.getMsg());
                return;
            }
            HeePayEatrxBalanceQueryRes data = commonResult.getData();
            VirtualBalanceDto virtualBalanceDto = new VirtualBalanceDto();
            virtualBalanceDto.setFrozenBalance(data.getFrozenBalance());
            virtualBalanceDto.setBalance(data.getBalance());
            channelVirtualAccountContext.setVirtualBalanceDto(virtualBalanceDto);
        }
        catch (Exception e) {
            channelVirtualAccountContext.setProcessStatus(false);
            channelVirtualAccountContext.setRemark(e.getMessage());
        }
    }

    @Override
    public void getMerchantReportSign(ChannelMerchantReportSignContext channelMerchantReportSignContext) {
        CommonResult<HeliPayEatrxConfig> configCommonResult = heliPayMerchantEatrxParamsHandle.heliPayEatrxConfig(channelMerchantReportSignContext.getProviderChannelConfig(),
                channelMerchantReportSignContext.isTest());
        if (!configCommonResult.isSuccess()) {
            channelMerchantReportSignContext.setRemark(configCommonResult.getMsg());
            channelMerchantReportSignContext.setProcessStatus(false);
            return;
        }
        HeliPayEatrxConfig heliPayEatrxConfig = configCommonResult.getData();
        Map<String, Object> params = new HashMap<>();
        MerchantReportInfoDO merchantReportInfo = channelMerchantReportSignContext.getMerchantReportInfo();
        params.put("userId", merchantReportInfo.getUserId());
        params.put("bankCardId", merchantReportInfo.getBankCardId());
        String url = url(channelMerchantReportSignContext.isTest()) + "/ea/accountBindVerifyUrlQuery";
        // 再提交数据
        CommonResult<HeePayEatrxReportSignRes> commonResult = productRequest(params, url, HeePayEatrxReportSignRes.class, heliPayEatrxConfig);
        if (!commonResult.isSuccess()) {
            channelMerchantReportSignContext.setRemark(commonResult.getMsg());
            channelMerchantReportSignContext.setProcessStatus(false);
            return;
        }
        HeePayEatrxReportSignRes eatrxReportSignRes = commonResult.getData();
        if (!eatrxReportSignRes.success()) {
            channelMerchantReportSignContext.setRemark(eatrxReportSignRes.getRetMsg());
            channelMerchantReportSignContext.setProcessStatus(false);
            return;
        }
        merchantReportInfo.setSignLink(eatrxReportSignRes.getVerifyUrl());
    }

    private BoaFuAppChannelParams payAppChannelParams(MerchantAppChannelDO merchantAppChannelDO) {
        return JsonUtils.parseObject(merchantAppChannelDO.getAppConfigJson(), BoaFuAppChannelParams.class);
    }

    @Override
    public String callBackResponse(CommonResult commonResult) {
        if (commonResult.isSuccess()) {
            return "success";
        }
        else {
            return commonResult.getMsg();
        }
    }
}
